#include "game.c"

void menu()
{
    printf("*****************\n");
    printf("*****************\n");
    printf("***1.开始游戏****\n");
    printf("***0.结束游戏****\n");
    printf("*****************\n");
    printf("*****************\n");
    printf("请选择数字1或者0：\n");
}

int GameLevel()
{
    printf("请选择数字：1.简单\n");
    printf("请选择数字：2.中等\n");
    printf("请选择数字：3.困难\n");
    int level = 1;
    scanf("%d",&level);
   switch (level)
   {
   case 1:
            ROW = 9;
            COL = 9;
            EASY_GAME = 10;
    break;
    case 2:
            ROW = 16;
            COL = 16;
            EASY_GAME = 40;
    break;
    case 3:
            ROW = 30;
            COL = 30;
            EASY_GAME = 99;
    break;
   default:
            printf("选择错误，难度为3\n");
            ROW = 30;
            COL = 30;
    break;
   }
    return ROW,COL;

}

void game()
{
    GameLevel();
    char mine[ROWS][COLS];//放雷的数组
    char show[ROWS][COLS];//展示的数组
    //初始化棋盘
    //1. mine数组最开始是全'0' 
    //2. show数组最开始是全'*'
    InitBoard(mine,ROWS,COLS,'0');
    InitBoard(show,ROWS,COLS,'*');

    //打印棋盘
    //DisplayBoard(mine,ROW,COL);
    DisplayBoard(show,ROW,COL);

    //布置雷
    SetMine(mine,ROW,COL);
    //SetMine(show,ROW,COL);
    //DisplayBoard(mine,ROW,COL);


    //2. 排查雷
    FindMine(mine, show, ROW, COL);

}

void test()
{
    int input = 0;
    srand((unsigned int)time(NULL));
    do
    {
        menu();
        scanf("%d",&input);
        switch (input)
        {
        case 1 :
            game();
            break;
        case 0:
            break;
        
        default:
            printf("选择错误，重新选择\n");
            break;
        }


    } while (input);
    
}

int main()
{
    test();
    return 0;
}